from PIL import Image

from utils.utils import huidu_JZ, get_bin_table, print_image, _9_gg_JZ


# 灰度降噪
image = Image.open("image/4.jpeg")
image = huidu_JZ(image, 115)

# 图片2值化
table = get_bin_table(100)
image = image.point(table, "1")
print_image(image)

# 9宫格降噪
image = _9_gg_JZ(image, 4)
print_image(image)

# 9宫格降噪
image = _9_gg_JZ(image, 4)
print_image(image)


image.save("result.jpeg")
print("")
